<%@ page import="com.wdg.dao.UserDao" %>
<%@ page import="com.wdg.dao.impl.UserDaoImpl" %>
<%@ page import="java.sql.ResultSet" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2025/3/16
  Time: 20:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div align="center">
<h3>查看用户列表（JSP方式）</h3>
<table border="1">
    <tr>
        <th>姓名</th>
        <th>密码</th>
        <th>年龄</th>
    </tr>
    <%
        UserDao dao = new UserDaoImpl();
        ResultSet rs = null;
        try {
            rs = dao.slecteSQL();
            while (rs.next()) {
                int id = rs.getInt("id");
                String user = rs.getString("user");
                String pw = rs.getString("pw");
                int age = rs.getInt("age");
    %>
    <tr>
        <td><%=user%>
        </td>
        <td><%=pw%>
        </td>
        <td><%=age%>
        </td>
    </tr>
    <%
            }
            rs.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    %>
</table>
</div>
</body>
</html>
